<style>
    #obj-update {
        padding: 20px 25px 25px 0;
    }

    #obj-update .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="obj-update">
    <form class="layui-form" action="" lay-filter="obj-update-form">
                <div class="layui-form-item febs-hide">
                    <label class="layui-form-label febs-form-item-require">记录id：</label>
                    <div class="layui-input-block">
                        <input type="text" name="id" data-th-value="${obj.id}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <input type="text" name="fileId" id="fileId" >
                    <label class="layui-form-label">文件：</label>
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn" id="test1">
                            <i class="layui-icon">&#xe67c;</i>上传
                        </button>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label febs-form-item-require">文件名：</label>
                    <div class="layui-input-block">
                        <input type="text" name="fileName" id="fileName" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label febs-form-item-require">上传文件名：</label>
                    <div class="layui-input-block">
                        <input type="text" name="realName" id="realName" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label febs-form-item-require">文件类型：</label>
                    <div class="layui-input-block">
                        <input type="text" name="fileType" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label febs-form-item-require">创建时间：</label>
                    <div class="layui-input-block">
                        <input type="text" name="createTime" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label febs-form-item-require">文件路径：</label>
                    <div class="layui-input-block">
                        <input type="text" name="filePath" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否一网通办：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isYwtb" value="1" title="是" checked="">
                        <input type="radio" name="isYwtb" value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否人才服务：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isRcfw" value="1" title="是" checked="">
                        <input type="radio" name="isRcfw" value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否公共服务：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isGgfw" value="1" title="是" checked="">
                        <input type="radio" name="isGgfw" value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否亲情在线：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isQqzx" value="1" title="是" checked="">
                        <input type="radio" name="isQqzx" value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否企业服务：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isQyfw" value="1" title="是" checked="">
                        <input type="radio" name="isQyfw" value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否项目服务：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isXmfw" value="1" title="是" checked="">
                        <input type="radio" name="isXmfw" value="0" title="否">
                    </div>
                </div>
            <div class="layui-form-item febs-hide">
                <button class="layui-btn" lay-submit="" lay-filter="obj-update-form-submit" id="submit"></button>
            </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect','upload'], function () {
        var $ = layui.$,
            febs = layui.febs,
            layer = layui.layer,
            upload = layui.upload,
            form = layui.form,
            obj = [[${obj}]],
            $view = $('#obj-update'),
            validate = layui.validate;
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: 'file/fileUpload/' //上传接口
            ,exts:'docx'
            ,done: function(res){
                //上传完毕回调
                layer.msg('上传成功');
                $("#fileName").val(res.data.fileName);
                $("#fileId").val(res.data.fileId);
                $("#realName").val(res.data.realName);
            }
            ,error: function(){
                //请求异常回调
            }
        });
        form.verify(validate);
        form.render();

        initobjValue();


        function initobjValue() {
            form.val("obj-update-form", {
                "id": obj.id,
                "fileName": obj.fileName,
                "realName": obj.realName,
                "fileType": obj.fileType,
                "createTime": obj.createTime,
                "filePath": obj.filePath,
                "isYwtb": obj.isYwtb,
                "isRcfw": obj.isRcfw,
                "isGgfw": obj.isGgfw,
                "isQqzx": obj.isQqzx,
                "isQyfw": obj.isQyfw,
                "isXmfw": obj.isXmfw,
            });
        }

        form.on('submit(obj-update-form-submit)', function (data) {
            if (febs.nativeEqual(data.field, obj)) {
                febs.alert.warn('数据未作任何修改！');
                return false;
            }
            febs.post(ctx + 'menuItemFile/update', data.field, function () {
                layer.closeAll();
                febs.alert.success('数据修改成功');
                $('#febs-obj').find('#query').click();
            });
            return false;
        });
    });
</script>